package com.suqiu.common.utils;

/**
 * @author zhengnaishan
 * @date 2022/3/18
 */
public enum ZoneEnum {


    INTERNAL("国内(中国)", "INTERNAL"),
    FOREIGN("外国", "FOREIGN"),
    GLOBAL("全球", "GLOBAL");


    final private String value; //数据库值
    final private String tagName;

    ZoneEnum(final String tagName, final String value) {

        this.tagName = tagName;
        this.value = value;
    }


    /**
     * 这里不做正确手机号校验
     *
     * @param phone
     * @return
     */
    public static ZoneEnum toEnumByPhone(final String phone) {
        if (phone.indexOf("+86") == 0) {
            return INTERNAL;
        } else {
            return FOREIGN;
        }
    }

    public String getValue() {
        return value;
    }

    public String getTagName() {
        return tagName;
    }
}
